<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 下
  Date: 2017/6/13
  Time: 20:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<link rel="stylesheet" href="<%=request.getContextPath()%>/resources/css/item.css" type="text/css"/>
<head>
    <title></title>
</head>
<body>
<h2>商品信息管理系统</h2>
<a href="add">添加商品</a><br/>
按名称查找：<form action="/search"><input type="text" name="search" />&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="serach"/></form><br/><br/><br/>
<div>
<table cellpadding="0" cellspacing="0">
    <tr>
        <th>id</th>
        <th>name</th>
        <th>city</th>
        <th>number</th>
        <th>price</th>
        <th>picture</th>
        <th>查看</th>
        <th>编辑</th>
        <th>删除</th>
    </tr>
<c:forEach items="${items}" var="um">
    <tr>
        <td>${um.id}</td>
        <td>${um.name}</td>
        <td>${um.city}</td>
        <td>${um.number}</td>
        <td>${um.price}</td>
        <td>${um.picture}</td>
        <td><a href="${um.id}">查看</a></td>
        <td><a href="${um.id}/update">编辑</a></td>
        <td><a href="${um.id}/delete">删除</a></td>
    </tr>
</c:forEach>
    <tr>
        <td colspan="9">
            <font size="2">共 ${page.totalPageCount} 页</font> <font size="2">第
            ${page.pageNow} 页</font> <a href="list?pageNow=1">首页</a>
            <c:choose>
                <c:when test="${page.pageNow - 1 > 0}">
                    <a href="list?pageNow=${page.pageNow - 1}">上一页</a>
                </c:when>
                <c:when test="${page.pageNow - 1 <= 0}">
                    <a href="list?pageNow=1">上一页</a>
                </c:when>
            </c:choose>
            <c:forEach var="i" begin="1" end="${page.totalPageCount}" step="1">
                &nbsp;<a href="list?pageNow=${i}">${i}</a>&nbsp;&nbsp;
            </c:forEach>
            <c:choose>
                <c:when test="${page.totalPageCount==0}">
                    <a href="list?pageNow=${page.pageNow}">下一页</a>
                </c:when>
                <c:when test="${page.pageNow + 1 < page.totalPageCount}">
                    <a href="list?pageNow=${page.pageNow + 1}">下一页</a>
                </c:when>
                <c:when test="${page.pageNow + 1 >= page.totalPageCount}">
                    <a href="list?pageNow=${page.totalPageCount}">下一页</a>
                </c:when>
            </c:choose>
            <c:choose>
                <c:when test="${page.totalPageCount==0}">
                    <a href="list?pageNow=${page.pageNow}">尾页</a>
                </c:when>
                <c:otherwise>
                    <a href="list?pageNow=${page.totalPageCount}">尾页</a>
                </c:otherwise>
            </c:choose>
        </td>
    </tr>
</table>
</div>
<%--<c:forEach items="${items}" var="um">
${um.id}-------${um.name}------${um.city}-------${um.number}
------${um.price}------${um.picture}<br/>
</c:forEach>--%>
</body>
</html>
